﻿<UserControl x:Class="DebIt.View.UserControls.ClientControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    x:Name="ClientCtrl"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}" d:DesignWidth="552" d:DesignHeight="325">


    <Border x:Name="boMain" BorderBrush="{StaticResource PhoneForegroundBrush}"  BorderThickness="3" Margin="8" >

        <Grid x:Name="grMain" Margin="-3">
            <Grid.ColumnDefinitions >
                <ColumnDefinition/>
                <ColumnDefinition Width="80"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="Auto" MinHeight="8"/>
            </Grid.RowDefinitions>
            <StackPanel x:Name="spName" Margin="8,4,0,0" Orientation="Horizontal">
                <TextBlock x:Name="tbLastName" TextWrapping="Wrap"  FontSize="32" Margin="0,0,16,0" Text="{Binding FirstName}" VerticalAlignment="Center" FontWeight="Bold"/>
                <TextBlock x:Name="tbFirstName" TextWrapping="Wrap"  FontSize="32" Margin="0,0,16,0" Text="{Binding LastName}" VerticalAlignment="Center" FontWeight="Bold"/>
            </StackPanel>
            <StackPanel x:Name="spDebit" Grid.Row="1" Orientation="Horizontal" Margin="8,0">
                <TextBlock x:Name="tbDebitName" TextWrapping="Wrap" Text="{Binding LocalizedResources.st_descr_debit, Source={StaticResource LocalizedStrings}}"  FontSize="18.667" VerticalAlignment="Top"/>
                <TextBlock x:Name="tbDebit" TextWrapping="Wrap" Text="{Binding LoanSum}"  FontSize="18.667" VerticalAlignment="Top"/>
            </StackPanel>
            <Button x:Name="btnEdit" Grid.Column="1" BorderBrush="Transparent" Foreground="Transparent" Grid.RowSpan="2" VerticalAlignment="Bottom" Height="75" Click="BtnEditClick" BorderThickness="0">
                <Image x:Name="imgEdit"  Source="../../icons/dark/edit.png"
					Height="75"
					Width="75"  HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Button>
            <ListBox Margin="0,8" Grid.Row="2" ItemsSource="{Binding ClientLoanStates}" ScrollViewer.VerticalScrollBarVisibility="Disabled" x:Name="lbExtend">

                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Width="456">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="0.35*"/>
                                <ColumnDefinition Width="0.65*"/>
                            </Grid.ColumnDefinitions>
                            <CheckBox IsChecked="{Binding IsPaid, Mode=TwoWay}" Command="{Binding ElementName=ClientCtrl, Path=LoanPaiedChange}" CommandParameter="{Binding}"/>
                            <TextBlock TextWrapping="Wrap" Text="{Binding Loan.Name}" VerticalAlignment="Center"  Grid.Column="1"/>
                            <StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Center">
                                <TextBlock TextWrapping="Wrap" Text="{Binding Loan.LoanPerClient}" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" Margin="0,4,0,4" />
                                <TextBlock TextWrapping="Wrap" Text="{Binding Loan.Currency}" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" Margin="8,4,0,4" />
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <Button x:Name="btnDelete" Grid.Column="1" BorderBrush="Transparent" Foreground="Transparent" VerticalAlignment="Top" Height="75" Command="{Binding ElementName=ClientCtrl, Path=DeleteClientCommand}" CommandParameter="{Binding}" BorderThickness="0" Grid.Row="2">
                <Image x:Name="imgDelete"  Source="../../icons/dark/delete.png"
            		Height="75"
            		Width="75"  HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </Button>
            <Button x:Name="btnTab" Content="Button" Grid.RowSpan="3" Opacity="0" Tap="BtnTapTapped" Margin="49,0,0,8"/>
            <Button x:Name="btnTabDetails" Content="Button" Opacity="0" Tap="BtnTapTapped" Margin="62,67,0,-155" Grid.Row="2" Grid.ColumnSpan="2" />
        </Grid>
    </Border>
</UserControl>
